import * as fs from 'fs';

function getLineNumber(fileContent: string, charPosition: number): number | undefined {
    let lineNumber = 1;
    for (let i = 0; i < charPosition && i < fileContent.length; i++) {
      if (fileContent[i] === '\n') {
        lineNumber++;
      }
    }
    return lineNumber;
  }
  
  const fileContent = fs.readFileSync('t.ts', 'utf8');
  const charPosition = 43; 
  const lineNumber = getLineNumber(fileContent, charPosition);
  
  console.log(`The character at position ${charPosition} is on line ${lineNumber}.`);
  